import 'package:flutter/material.dart';
import 'package:fluro/fluro.dart';
import '../pages/index.dart';
import '../pages/user/Login.dart';
import '../pages/notFound/NotFound.dart';
import '../pages/course/CourseDetail.dart';
import '../pages/mine/Profile.dart';
import '../pages/pay/Pay.dart';
import '../pages/splash/Splash.dart';
// 声明路由处理器
var notFoundHandler = Handler(
  handlerFunc: (BuildContext? context, Map<String, List<String>> params) {
    return  NotFound();
  }
);

var indexHandler = Handler(
  handlerFunc: (BuildContext? context, Map<String, List<String>> params) {
    return  Index();
  }
);

var loginHandler = Handler(
  handlerFunc: (BuildContext? context, Map<String, List<String>> params) {
    return  Login();
  }
);

/// 课程详情
var CourseDetailHandler = Handler(
  handlerFunc: (BuildContext? context, Map<String, List<String>> params) {
    print('详情参数 $params');
    return CourseDetail(id: int.parse(params['id']!.first), title: params['title']!.first);
  }
);

// 编辑个人信息
var ProfilelHandler = Handler(
  handlerFunc: (BuildContext? context, Map<String, List<String>> params) {
    return Profile();
  }
);

/// 支付
var PayHandler = Handler(
  handlerFunc: (BuildContext? context, Map<String, List<String>> params) {
    print('详情参数 $params');
    return Pay(id: int.parse(params['id']!.first), title: params['title']!.first);
  }
);

/// splash页面
var SplashHandler = Handler(
  handlerFunc: (BuildContext? context, Map<String, List<String>> params) {
    return Splash();
  }
);
var SplashHandler2 = Handler(
  handlerFunc: (BuildContext? context, Map<String, List<String>> params) {
    return  Login();
  }
);